/// external_app_launcher打开app的辞典类
class AppSchema {
  static final AppSchema _instance = AppSchema._();
  AppSchema._();

  factory AppSchema() {
    return _instance;
  }

  /// 淘宝
  static AppInfo taobao = AppInfo(
    androidPackageName: "com.taobao.taobao",
    iosUrlScheme: "taobao://",
  );
  /// QQ
  static AppInfo qq = AppInfo(
    androidPackageName: "com.tencent.mobileqq",
    iosUrlScheme: "mqq://",
  );
  /// 微信
  static AppInfo weixin = AppInfo(
    androidPackageName: "com.tencent.mm",
    iosUrlScheme: "weixin://",
  );
  /// 京东
  static AppInfo baidu = AppInfo(
    androidPackageName: "com.jingdong.app.mall",
    iosUrlScheme: "openapp.jdmoble://",
  );
  /// 美团
  static AppInfo meituan = AppInfo(
    androidPackageName: "com.sankuai.meituan",
    iosUrlScheme: "imeituan://",
  );
  /// 点评
  static AppInfo dianping = AppInfo(
    androidPackageName: "",
    iosUrlScheme: "dianping://",
  );
  /// 支付宝
  static AppInfo zfb = AppInfo(
    androidPackageName: "com.eg.android.AlipayGphone",
    iosUrlScheme: "alipay://",
  );
  /// 微博
  static AppInfo weibo = AppInfo(
    androidPackageName: "com.sina.weibo",
    iosUrlScheme: "sinaweibo://",
  );
  /// 知乎
  static AppInfo zhihu = AppInfo(
    androidPackageName: "",
    iosUrlScheme: "zhihu://",
  );
  /// 豆瓣fm
  static AppInfo douban = AppInfo(
    androidPackageName: "",
    iosUrlScheme: "doubanradio://",
  );
  /// uc浏览器
  static AppInfo uc = AppInfo(
    androidPackageName: "com.UCMobile",
    iosUrlScheme: "ucbrowser://",
  );
  /// 百度地图
  static AppInfo baiduMap = AppInfo(
    androidPackageName: "com.baidu.BaiduMap",
    // https://lbsyun.baidu.com/index.php?title=uri
    androidSchema: "baidumap://map",
    iosUrlScheme: "baidumap://",
  );
  /// 优酷
  static AppInfo youku = AppInfo(
    androidPackageName: "com.taobao.taobao",
    iosUrlScheme: "youku://",
  );
  /// 有道词典
  static AppInfo youdaoDict = AppInfo(
    androidPackageName: "",
    iosUrlScheme: "yddictproapp://",
  );
  /// 抖音短视频
  static AppInfo douyin = AppInfo(
    androidPackageName: "com.ss.android.ugc.aweme",
    iosUrlScheme: "",
  );
  /// 今日头条
  static AppInfo toutiao = AppInfo(
    androidPackageName: "com.ss.android.article.news",
    iosUrlScheme: "",
  );
  /// 今日头条极速版
  static AppInfo toutiaoLite = AppInfo(
    androidPackageName: "com.ss.android.article.lite",
    iosUrlScheme: "",
  );
  /// 拼多多
  static AppInfo pdd = AppInfo(
    androidPackageName: "com.xunmeng.pinduoduo",
    iosUrlScheme: "",
  );
  /// BOSS直聘
  static AppInfo boss = AppInfo(
    androidPackageName: "com.hpbr.bosszhipin",
    iosUrlScheme: "",
  );
  /// 爱奇艺
  static AppInfo aqy = AppInfo(
    androidPackageName: "com.qiyi.video",
    iosUrlScheme: "",
  );
  /// 钉钉
  static AppInfo dingding = AppInfo(
    androidPackageName: "com.alibaba.android.rimet",
    iosUrlScheme: "",
  );
  /// 小红书
  static AppInfo xhs = AppInfo(
    androidPackageName: "com.xingin.xhs",
    iosUrlScheme: "",
  );

  static Map<String, AppInfo> toMap() {
    return  {
      "taobao": taobao,
      "qq": qq,
      "weixin": weixin,
      "baidu": baidu,
      "meituan": meituan,
      "dianping": dianping,
      "zfb": zfb,
      "weibo": weibo,
      "zhihu": zhihu,
      "douban": douban,
      "uc": uc,
      "baiduMap": baiduMap,
      "youku": youku,
      "youdaoDict": youdaoDict,
      "douyin": douyin,
      "toutiao": toutiao,
      "toutiaoLite": toutiaoLite,
      "pdd": pdd,
      "boss": boss,
      "aqy": aqy,
      "dingding": dingding,
      "xhs": xhs
    };
  }
}

class AppInfo {
  /// 安卓端需要打开的APP的包名
  String? androidPackageName;
  /// 安卓端注册的Schema
  String? androidSchema;
  bool? openStore;
  /// IOS需要打开的APP的Scheme
  String? iosUrlScheme;
  String? appStoreLink;

  AppInfo({
    this.androidPackageName,
    this.androidSchema,
    this.iosUrlScheme,
    this.openStore,
    this.appStoreLink,
  });
}
